package org.eclipse.swt.snippets;

public class ThreadFilter implements Filter {

    private String thread;

    public ThreadFilter(String thread) {
        this.thread = thread;
    }

    @Override
    public boolean filter(Message msg) {
        return thread.equals(msg.getThread());
    }

    @Override
    public int hashCode() {
        int hashCode = thread.hashCode();
        return hashCode;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj instanceof ThreadFilter) {
            ThreadFilter f = (ThreadFilter) obj;
            return thread == f.thread;
        }
        return false;
    }

    @Override
    public String toString() {
        return thread;
    }
}
